home *** CD-ROM | disk | FTP | other *** search
/ Speccy ClassiX 1998 / Speccy ClassiX 98.iso / amiga_system / the_aminet / comm / bbs / maxsbbsus.lha / MAX154 / TBM / Scripts / arc.scp < prev    next >
Text File  |  1995-04-25  |  5KB  |  131 lines

  1. The following is a textfile from my BBS.  At the bottom is the file I
  2. currently use, it's a bit smarter than the one outlined here:
  3.  
  4.   
  5.  
  6.   Okay, you've got a directory full of files, and you want to do the same
  7. operation to each of them.  Some examples might be:
  8.  
  9. > Editing a number of textfiles, then doing something to each of them after
  10. you're through, such as renaming them or copying a duplicate to a different
  11. directory.
  12.  
  13. > Compressing a number of files to individual LHA files.
  14.  
  15. > Converting a number of .arc, .zoo or .lzh files to the LHA format.
  16.  
  17. > Adding a ReadMe file or something to a number of LHA files, or deleting
  18. every zzenpad.foo and display.me.  
  19.  
  20. Really, any operation that you can list out as a standard Execute scriptfile,
  21. but this will allow you to do it to a number of files, one-by-one.
  22.  
  23.  
  24.   Let's take an easy example.  Let's say we have a bunch of pictures we want
  25. to compress to individual LHA files.  They're in our dh0:Files directory.
  26.   
  27.   Smart DOS uses the List command to list out the Files directory, and the
  28. "LFORMAT" option tells the List command to name them like wildcards.  So
  29. "<name>" is the name of the next file on the list.  If we were making an
  30. Execute scriptfile, planning on doing this to just ONE file, it would look
  31. something like the following.  This could be done better, but for this
  32. example we'll just take it step-by-step:
  33.  
  34.  
  35.   MakeDir Ram:Temp                ;we'll do all the work here
  36.   CD Ram:Temp
  37.  
  38.   Copy dh0:Files/Pic1 Ram:Temp    ;copies the file to Ram:Temp
  39.   LHA a Pic1                      ;compresses the file to Pic1.lha
  40.   Copy Pic1.lha dh0:Files         ;copies Pic1.lha back to hard drive
  41.   Delete #?                       ;deletes files in work area
  42.  
  43.  
  44.   Okay, with me so far?  Now check out the following.  To note is that the 
  45. Echo line is ONE line with your text editor, although it'll break into two 
  46. lines here if you're using a text viewer.  This is the scriptfile that you
  47. Execute:
  48.  
  49.  
  50. .k dev                    
  51. .def dev "Ram:"            ;no, I don't know if all of this stuff is
  52. .bra {                     ;necessary, just leave it in
  53. .ket }
  54.  
  55. MakeDir Ram:Temp
  56. CD Ram:Temp
  57.  
  58. List >Ram:x1 dh0:Files/#?.lha nohead quick LFORMAT "Execute Ram:x2 %s %s"
  59.  
  60. Echo >Ram:x2 ".k path,name*nCopy dh0:Files/<name> Ram:Temp*nLHA a <name>*nCopy <name>.lha dh0:Files*nDelete #?"
  61.  
  62. Execute Ram:x1             ;this is what actually does the work
  63.  
  64.  
  65.   Okay, you can kinda see what that did.  It listed out the files in
  66. dh0:Files, it kept the list "clean" with nohead and quick, and the LFORMAT
  67. links the Echo line on each entry, with the whole mess being outputted to a
  68. scriptfile in Ram called x1, which is then Executed.
  69.  
  70.   The Echo command is ONE line, remember.  It should basically be what we had
  71. listed up above, with the little "*n" jobbies in between each command.  I
  72. guess the line can be as long as 255 characters, the max chars of a DOS line.
  73. If you need more than that, I suppose one of your commands could be the
  74. executing of a scriptfile which would continue things.  Don't know if the
  75. sub-scriptfile would recogninze the "<name>" wildcard or not, never tried it.
  76. Interesting thought, though.  If it follows DOS rules, it "should" work.  But
  77. we all know what "should" means in the computer world.  :)
  78.  
  79.   Following is an example of how to use subdirectories in all this, like if
  80. you're compressing LHA files with subdirectories.  This converted my board's
  81. LZH files to LHA:
  82.  
  83.  
  84. List >Ram:x1 dh0:Audio/#?.lzh nohead quick LFORMAT "Execute Ram:x2 %s %s"
  85.  
  86. Echo >Ram:x2 ".k path,name*nc:LHA x <path><name>*nc:LHA -erx a <name> #?*nCopy #?.lzh dh0:Audio/#?.lha*nc:Delete <path><name>*nc:Delete #? all"
  87.  
  88.  
  89.   The "Delete <path><name>" was really ballsy, as it was deleting my precious
  90. board files while doing the work, but space-wise, it had to be done that way.
  91. What you're looking at are the "<path>" commands, the "-erx" and #? options
  92. so LHA can do its thing, and the "all" option for Delete.
  93.   
  94.   Basically, once you get it going for one operation, you just keep a Master
  95. kicking around somewhere, and when you want to do something different in the
  96. future, just plug in the different pathnames and commands.  
  97.  
  98.   1.3 users, both the Arp Rename and Copy commands are needed.
  99.  
  100.                                    *
  101.  
  102.   Okay, so here's the one I commonly use when I want to archive a bunch of
  103. files.  It's `trick' is that you just use the Assign command to assign XXX:
  104. over to whatever directory the files are in.  It copies XXX:<files> to Ram,
  105. one by one, compresses them, then copies the .lha files back to XXX: 
  106.  
  107.  
  108. .k dev
  109. .def dev "Ram:"
  110. .bra {
  111. .ket }
  112.  
  113. cd ram:
  114. failat 25
  115. delete >nil: ram:temp all
  116.  
  117. failat 25
  118. makedir ram:temp
  119.  
  120. cd ram:temp
  121.  
  122. list >Ram:x1 XXX: nohead quick lformat "execute Ram:x2 %s %s"
  123. echo >Ram:x2 ".k path,name*ncopy XXX:<name> ram:temp*nlha a <name>*ncopy #?.LHA XXX:*ndelete #?"
  124.  
  125. execute Ram:x1
  126. cd ram:
  127. delete ram:x1 ram:x2 ram:temp all
  128.  
  129.  
  130. Good luck!
  131.